package com.hup.sidebar.framework.util;

import android.graphics.Color;

/**
 * @author hugan
 * @date 2022/6/4
 */
public class ColorUtil {

    private static final float FACTOR = 0.7f;

    public static int darker(int r, int g, int b, int a) {
        return Color.argb(a,
                Math.max((int) (r * FACTOR), 0),
                Math.max((int) (g * FACTOR), 0),
                Math.max((int) (b * FACTOR), 0));
    }

    public static int darker(int color) {
        return Color.argb(Color.alpha(color),
                Math.max((int) (Color.red(color) * FACTOR), 0),
                Math.max((int) (Color.green(color) * FACTOR), 0),
                Math.max((int) (Color.blue(color) * FACTOR), 0));
    }


}
